/**
 * Fuzzy Refrigerator: Refrigerator with Fuzzy Logic as temperature controller
 * Copyright (C) 2012  Izwan Azmi
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

 /**
  * @file mamdani.h
  * @brief
  * @author Izwan Azmi <izwanazmi90@gmail.com>
  */

#ifndef MAMDANI_H
#define MAMDANI_H

#include "fuzzy.h"

typedef struct {
    float lim_kiri;
    float lim_kanan;
    float lim_atas;
} clip;

class mamdani : public fuzzy {
public:
    mamdani();
    virtual ~mamdani();
protected:
    float clipped(float [], trapezoid [], int);
    float defuzzification(trapezoid [], float [], float, float, float, int);
    clip cl[3];
private:
    float interceptX(trapezoid, trapezoid, jenis_trapz);
};

#endif // MAMDANI_H
